<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2022/6/8
 * Time: 9:44
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

declare(strict_types=1);

namespace app\web\controller;

use app\common\business\BusUser;
use app\common\lib\Show;
use app\common\lib\Status;

class Login extends Base
{
    public function user()
    {
        $mobile = $this->request->param('mobile', '', 'trim');
        $password = $this->request->param('password', '', 'trim');
        $data = [
            "mobile" => $mobile,
            "password" => $password
        ];
        try {
            $res = (new BusUser())->doLogin($data);
        } catch (\Exception $e) {
            return Show::json_show(Status::mini_error, $e->getMessage());
        }
        if ($res) {
            return Show::json_show(Status::mini_normal, 'ok', $res);
        } else {
            return Show::json_show(Status::mini_error, "内部异常");
        }
    }
}